<!-- loading modal -->
<div id="loading-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content" style="text-align:center; " >
    	<img src="__PUBLIC__/Admin/img/loading.gif" style="margin:25px 0" />
    </div>
  </div>
</div>

<!-- sure modal -->
<div id="sure-modal" class="modal fade">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title">警告</h4>
      </div>
      <div id="sure-modal-body" class="modal-body">
        <p>One fine body&hellip;</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn-flat gray" data-dismiss="modal">取消</button>
        <button id="btn-sure-del" type="button" class="btn-flat danger">确认删除</button>
      </div>
    </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<script>
	
	function lshow() {
		$("#loading-modal").modal('show',{
			backdrop:false,
			keyboard:false,
		});
	}


	function lhide() {
		$("#loading-modal").modal('hide');
	}

	function sshow(url,msg) {
		$("#sure-modal-body").html(msg);
		$("#btn-sure-del").click(function(){
			$("#sure-modal").modal('hide');
			lshow();

			/**
			 * php 5.6 bug
			 * 
			 * Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0
             * Warning: Cannot modify header information - headers already sent in Unknown on line 0
			 *
			 * 解决次bug 需要添加一个没有意义的参数
			 */
			$.post(url,{data:''},function(result){
                var obj = eval('(' + result + ')');
                if (obj.result == 'RESULT_OK') {
                    lhide();
                    location.reload();
                } else {
                	lhide();
                    alert(obj.msg);
                }
            });

		});

		$("#sure-modal").modal('show');
	}

</script>